package com.chenyao.bookstore.util;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

public class Util {
	public static final void sendData2Client(final HttpServletResponse response, final String content,
			final boolean isJSONData) throws IOException {
		response.setHeader("Cache-Control", "no-cache");
		if (isJSONData)
			response.setContentType("application/json;charset=UTF-8");
		else
			response.setContentType("text/xml;charset=UTF-8");
		PrintWriter writer = response.getWriter();
		writer.print(content);
		writer.flush();
	}

	private Util() {
	}
}
